require 'benchmark'
module TestPushSpeed
  remote_path = "ssh://git@isource-sz.huawei.net:2222/lWX181282/tt"
  nums = ARGV.first.to_i || 50
  threadnums = []

  nums.times do |n|
    push_path = remote_path + n.to_s + ".git"
    `git remote add #{n.to_i} #{push_path}`
  end

  `echo "100 #{Time.now}" > 1`
  `git add .`
  `git commit -m "1"`

  nums.to_i.times do |n|
    threadnums << Thread.new(n) do
      timeeach = Benchmark.realtime do
        cmd = "git push -f #{n.to_i} master"
        puts cmd
        `#{cmd}`
      end
    end
  end
  threadnums.each &:join
end